
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;

using Swaf;
using Swaf.BizObj;
using Swaf.Call;
using Swaf.Container;

namespace Swaf.BizRule
{
	public delegate void BizObjRuleDataAvailable(IBizObjRules r, IBizObjCursor bizObjList, IBizObj bizObj);
	public delegate void BizObjRuleUpdateComplete(IBizObjRules r, IResults rs);
	/// <summary>
	/// Summary description for IBizObjRules.
	/// </summary>
	public interface IBizObjRules
	{
		void defineDocumentContext(IApplication app, INameAddressSupport docModel);
		string GetBizObjListRule{get;}
		string GetDetailedBizObjRule{get;}
		string UpdateBizObjRule{get;}
		string UpdateBizObjListRule{get;}
		string AddNewBizObjRule{get;}
		string DeleteBizObjRule{get;}
		IBizObjDefinition BizObjType{get;}
	
		/// <summary>
		/// Returns the IBizObj instance associated with this element.  Can be null if 
		/// the IBizObj object has not been retrieved.
		/// </summary>
		IBizObj BizObj{get;}
		/// <summary>
		/// Returns the IBizObjCursor instance associated with this object. Can be null
		/// if the IBizObjList has not been retrieved.
		/// </summary>
		IBizObjList BizObjList{get;}
		object BizObjListRuleParams{get;set;}
		object BizObjDetailRuleParams{get;set;}

		void startGetBizObjList(object ruleParam);
		void startGetBizObjList(object ruleParam, object callback, string callbackMethod);

		void startGetDetailedBizObj(object ruleParam);
		void startGetDetailedBizObj(object ruleParam, object callback, string callbackMethod);
		
		void addBizObjChangedListener(BizObjRuleDataAvailable listener);
		void addBizObjListChangedListener(BizObjRuleDataAvailable listener);

		void addBizObjUpdateCompleteListener(BizObjRuleUpdateComplete listener);
		void addBizObjAddNewCompleteListener(BizObjRuleUpdateComplete listener);
		void addBizObjDeleteCompleteListener(BizObjRuleUpdateComplete listener);
	}
}
